home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 10.0 KB | 278 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: SysConfig.vu
- #
- # Contains: xxx put contents here xxx
- #
- # Written by: Naga
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <13> 12/17/93 KTA Changed gFileToolOutput to gTestCaseLoggingMethod.
- # <12> 12/3/93 ML Removed PrintSystemFilesRecord(). Simplified and renamed
- # CallOnTarget() to SystemFileInfo(). Created SystemFolderInfo().
- # Generalized and renamed WriteTargetRecords() to
- # WriteTargetInfo().
- # <11> 12/1/93 ML Fixed bug in outputting of MachineType, FPUtype, and MMUtype if
- # both notebook and filetool output are desired
- # <10> 11/30/93 ML Replaced CPUType with MachineType
- # <9> 9/23/93 KTA Only write target records to notebook if gNoteBookOutPut = 1.
- # <8> 9/22/93 KTA Removed an undefined globList
- # <6> 8/24/93 KTA Removed more info that was related to the Globals Field.
- # <5> 8/24/93 KTA Removed Globals Field from target block and put it into the
- # Suite Block.
- # <4> 8/24/93 KTA Removed a colon from the System Files block opener.
- # <3> 8/20/93 KTA Changes to support new Phoenix data format.
- # <2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- #
- # ****************************************************************************
- #
-
- Libraries "Globals.Lib", "OnTarget.Lib", "TCS.Lib", "FileTool.Lib", "Gestalt.Lib", "Output.Lib";
-
- #########################################################################
- # LogSystemFilesRecord(theFolderList, FolderName)
- #========================================================================
- # Author: KTA
- # Description: This task is used to print the list returned from the OnTarget
- # 'vers' service. All output will be directed to the TargetRecordsFile.
- # This data will be formatted specifically for Phoenix.
- # Parameters: theFolderList - list returned from call to OnTarget - 'vers' service
- # FolderName - the name of the special folder that the 'vers' service
- # returned info for.
- # Returns: Nada
- # Examples: ExtensionsList := OnTarget('vers','system','extn');
- # LogSystemFilesRecord(ExtensionsList , 'extn');
- # Assumptions: TargetRecordsFile - is a global thathas been predefined
- #========================================================================
- # History:
- #
- #########################################################################
- task LogSystemFilesRecord(theFolderList := 0, FolderName := '')
- begin
- global TargetRecordsFile;
- if(theFolderList)
- begin
- for each TargetRecord in theFolderList
- begin
- FolderNameString := " FolderName : {FolderName}∂n";
- Title := " Title : " + TargetRecord[1] + "∂n";
- TypeString := " Type : " + TargetRecord[2] + "∂n";
- VersionString := " Version : " + TargetRecord[3] + "∂n";
- Appersands := " &&∂n";
- theString := FolderNameString + Title + TypeString + VersionString + Appersands;
- myreturn := WriteToFile(TargetRecordsFile, theString);
- end;
- end;
- else
- println "TheFolderList input parameter was not valid";
- end;
-
- #########################################################################
- # SystemFileInfo(pFileType)
- #========================================================================
- # Author: KTA
- # Description: This task is used to call Ontarget for system file info
- # and check for errors.
- # Parameters: pFileType - 'extn' - extension information
- # 'ctrl' - control panel information
- # 'macs' - info on files in the system folder root
- # Returns: 0 - Something failed
- # Data - anything Ontarget returns
- # Examples: CallOnTarget({'vers','system','extn'});
- # Assumptions: Call InitOntarget first
- #========================================================================
- # History:
- # ML 12/2/93 renamed task, renamed and simplified parameter
- #########################################################################
- Task SystemFileInfo( pFileType )
- begin
- specialFolder := pFileType;
- # LogStr("Calling Ontarget 'vers' service for info on '{specialFolder}' folder");
- Result := OnTarget( 'vers','system', specialFolder );
- if (Result[1] <> 0) # Check for errors
- begin
- Println "Error during OnTarget call";
- Println "Error - ", Result[1], " ", Result[3];
- Return 0;
- end;
- else
- begin
- return Result[2];
- end;
- end;
-
- #########################################################################
- # SystemFolderInfo(printSystemFolderInfo)
- #========================================================================
- # Author: ML
- # Description: Gets and return info on system folder
- # Parameters: printSystemFolderInfo - print out the info
- # Returns: lists of system files and info
- # 0 if OnTarget unsuccessful
- # Examples: SystemFolderInfo();
- # Assumptions: OnTarget installed on target
- #========================================================================
- # History:
- #
- #########################################################################
- task SystemFolderInfo( printSystemFolderInfo:=0 )
- begin
-
- x:= OnTarget('Initialize',1);
- if x[1] = 0 # if OnTarget successful
- begin
-
- #### Extensions
- ExtensionsList := { "Extensions", SystemFileInfo('extn') };
-
- #### ControlPanels
- ControlPanelsList := { "Control Panels", SystemFileInfo('ctrl') };
-
- #### System Folder Root Files
- SystemFolderRootFilesList := { "System Folder Root Files", SystemFileInfo('macs') };
-
- OnTarget('Quit');
-
- returnVal := {ExtensionsList, ControlPanelsList, SystemFolderRootFilesList};
-
- if printSystemFolderInfo
- begin
- println;
- for each item in returnVal
- begin
- println item[1],":";
- println;
- for each subitem in item[2]
- println subitem[1]," ",subitem[2]," ",subitem[3];
- println;
- end; # for each item in returnVal
- end; # if printSystemFolderInfo
-
- end; # if OnTarget successful
-
- else # if OnTarget NOT successful
- begin
- println "Problem initializing OnTarget";
- returnval := 0;
- end; # if OnTarget NOT successful
-
- return(returnval);
-
- end;
-
- #########################################################################
- # WriteTargetInfo()
- #========================================================================
- # Author: KTA
- # Description: This task is write target records
- # Parameters: none
- # Returns: nada
- # Examples: WriteTargetInfo();
- # Assumptions:
- #========================================================================
- # History:
- # ML 12/2/93 Generalized to output either target records to Phoenix
- # if gTestCaseLoggingMethod turned on or target information to the
- # notebook if gNoteBookOutput turned on.
- # Revised to call SystemFolderInfo() task.
- # Renamed task to reflect more general nature.
- #########################################################################
- Task WriteTargetInfo()
- begin
- global gTestCaseLoggingMethod, gNoteBookOutput;
-
- specialChar := "π†";
- semiColon := "; ";
-
-
- theMachineState := MachineState();
- MachineType := assoc('MachineType', theMachineState);
- MMUType := assoc('MMUType', theMachineState);
- FPUType := assoc('FPUType', theMachineState);
-
- theSystemFolderInfo := SystemFolderInfo();
- if theSystemFolderInfo
- begin
- ExtensionsList := assoc('Extensions', theSystemFolderInfo);
- ControlPanelsList := assoc('Control Panels', theSystemFolderInfo);
- SystemFolderRootFilesList := assoc('System Folder Root Files', theSystemFolderInfo);
- end;
-
- match[target t:?targName];
- match[system v:?myVersion s:?myScript];
-
- if (gTestCaseLoggingMethod = 1)
- begin
- global gFileToolOutputFile, gFileToolOutputTempFile,gMachineName, gTCSOutputPath;
- SetUpOutput();
- global TargetRecordsFile := "{gTCSOutputPath}{gMachineName}.TargetRecords"; # Define TargetRecords File variable
- CreateTargetRecords := ExistsOrCreate(TargetRecordsFile); # Create the file
- if( CreateTargetRecords) # Could we enable the file to exist
- begin
- LogStr( "Target Records will be written to the '{TargetRecordsFile}' file");
-
- if( CreateTargetRecords = 1) # File already Existed
- EraseFile( TargetRecordsFile );
-
- TargetName := " TargetName: {targName}∂n"; # TargetName
- SuiteBlockOpener := " SYSTEM FILES [∂n"; # TargetName
-
- theString := TargetName + SuiteBlockOpener;
- myreturn := WriteToFile(TargetRecordsFile, theString);
- if(myreturn[1] <> 0)
- begin
- LogStr( "Problem writing to file {TargetRecordsFile}");
- Println " Error : ", myreturn[1], " ", myreturn[3];
- Println "Turning NoteBook output - ON, since FileTool output failed";
- gNoteBookOutput := 1;
- end;
- else
- begin
-
- if ExtensionsList
- LogSystemFilesRecord(ExtensionsList , 'extn'); # Items in Special Folders
- if ControlPanelsList
- LogSystemFilesRecord(ControlPanelsList , 'ctrl');
- if SystemFolderRootFilesList
- LogSystemFilesRecord(SystemFolderRootFilesList , 'macs');
-
-
- SuiteBlockCloser := " ]∂n"; # TargetName
- ScriptSys := " ScriptSys: {myScript}∂n";
- ScriptVers := " ScriptVers: {myVersion}∂n";
- myMachineType := " MachineType:{MachineType}∂n"; # MachineType
- myMMUType := " MMUType: {MMUType}∂n"; # MMUType
- myFPUType := " FPUType: {FPUType}∂n"; # FPUType
- Appersands := " &&∂n";
-
- theString := SuiteBlockCloser + ScriptSys + ScriptVers + myMachineType + myMMUType + myFPUType + Appersands;
- myreturn := WriteToFile(TargetRecordsFile, theString);
- end;
- end; # if (gTestCaseLoggingMethod)
- else
- begin
- println "Couldn't create TargetRecords file";
- Println "Turning NoteBook output - ON, since FileTool output failed";
- gNoteBookOutput := 1;
- end;
- end; # if (global gTestCaseLoggingMethod)
-
- if (global gNoteBookOutput)
- begin
- InitTCSLogging(); # remove when Gestalt globals decoupled from this task
- MachineState(1);
- SystemFolderInfo(1);
- end; # if (global gNoteBookOutput)
-
- end; # WriteTargetRecords()
-
- InitGlobals();
- WriteTargetInfo();